﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace Noc.Pomodoro.Controls
{
    /// <summary>
    /// Interaction logic for AnalogClockControl.xaml
    /// </summary>
    public partial class AnalogClockControl : UserControl
    {
        /// <summary>
        /// Backing store for Interval.
        /// </summary>
        public static DependencyProperty TimeProperty = DependencyProperty.Register("Time", typeof(TimeSpan), typeof(AnalogClockControl), new PropertyMetadata(new TimeSpan()));

        public AnalogClockControl()
        {
            InitializeComponent();
        }

        public TimeSpan Time
        {
            get { return (TimeSpan)GetValue(TimeProperty); }
            set { SetValue(TimeProperty, value); }
        }

        private void OnSizeChanged(object sender, SizeChangedEventArgs e)
        {
            var grid = this.Content as Grid;
            var transform = grid.LayoutTransform as ScaleTransform;
            transform.ScaleX = e.NewSize.Width / 100.0;
            transform.ScaleY = e.NewSize.Height / 100.0;
        }
    }
}